import { ref, reactive, computed, onMounted } from 'vue'
import { _GetVideo } from '../api/video'
function getVideo(){
  interface Idata {
    videoList: Array<any>
    pageStart: number
    count: number
    searchText: string
    getVideo(): void
  }
  
  let datas: Idata = reactive({
    videoList: [],
    pageStart: 1,
    searchText: '',
    count: 0,
    say () {},
    getVideo: async () => {
      var res:any = await _GetVideo({
        pageStart: datas.pageStart,
        searchText: datas.searchText
      })
      console.log(res)
      datas.videoList = res.data.list
      datas.count = res.data.count
    },
    douNum: computed(() => {
      return datas.pageStart * 2
    })
  })
  onMounted(() => {
    datas.getVideo()
  })
  return datas
}
